﻿using System.Reflection;

namespace DiffuseEnjoyIdle.Extension.Extensions.AutoMap
{
    public static class MapperRegister
    {
        public static Type[] MapType()
        {

            var allIem = Assembly
               .GetEntryAssembly()
               .GetReferencedAssemblies()
               .Select(Assembly.Load)
               .SelectMany(y => y.DefinedTypes)
               .Where(type =>
                typeof(MapProfile).GetTypeInfo().IsAssignableFrom(type.AsType()));
            List<Type> allList = new List<Type>();
            foreach (var typeinfo in allIem)
            {
                var type = typeinfo.AsType();
                allList.Add(type);
            }
            Type[] alltypes = allList.ToArray();
            return alltypes;

        }
    }
}
